package com.lujianfei.waterpower.ui.main;

import android.content.Intent;

import com.lujianfei.waterpower.ui.power.PowerActivity;
import com.lujianfei.waterpower.ui.water.WaterActivity;

import java.util.List;

public class MainPresenter implements MainContract.Presenter {
    MainContract.View view;
    MainContract.Model model;

    public MainPresenter(MainContract.View view) {
        this.view = view;
        this.model = new MainModel();
    }

    @Override
    public void loadData() {
        List<MainEntity> mainEntities = model.getData();
        view.updateData(mainEntities);
    }

    @Override
    public void openPower() {
        view.getContext().startActivity(new Intent(view.getContext(),PowerActivity.class));
    }

    @Override
    public void openWater() {
        view.getContext().startActivity(new Intent(view.getContext(),WaterActivity.class));
    }
}
